using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum SwicthDirection
{
    Hroizontal,
    Vertical
}
public enum ViewType
{
    None,
    Top,
    Side
}
public class SperspectiveConversionTrigger : TriggerBase
{
    [SerializeField] private SwicthDirection _stateSwicthDirection;
    [SerializeField] private ViewType _leftViewType;
    [SerializeField] private ViewType _rightViewType;
    [SerializeField] private ViewType _upViewType;
    [SerializeField] private ViewType _downViewType;
    protected override void OnTriggerExit2D(Collider2D other)
    {
        base.OnTriggerExit2D(other);
        if (other.CompareTag("Player") == false)
            return;
        Transform playerTrans = other.transform;
        Vector2 exitDirection = playerTrans.position - _coll.bounds.center;

        SwitchState(exitDirection);
    }
    
    private void SwitchState(Vector2 direction)
    {
        ViewType switchViewType = ViewType.None;
        if (_stateSwicthDirection == SwicthDirection.Vertical)
            switchViewType = direction.y > 0 ? _upViewType : _downViewType;

        else if (_stateSwicthDirection == SwicthDirection.Hroizontal)
            switchViewType = direction.x > 0 ? _rightViewType : _leftViewType;
        Debug.Log(switchViewType);
        EventCenter.TriggerEvent(EventName.SwitchViewState, switchViewType);
    }
}
